home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.04 Apr 95 / TreeAppƒ / Eric's C++ Libraries / Interface Classes / CPPScrollWindow.cp < prev    next >
Encoding:
Text File  |  1996-04-04  |  3.9 KB  |  128 lines  |  [TEXT/KAHL]

  1. /***************************************************** IMPLEMENTATION
  2.     DATE:    10/19/93
  3.  
  4.     CLASS:  CPPScrollWindow
  5.     
  6.     SUPERCLASS: CPPWindow, CPPScrollArea
  7.     
  8.         This C++ class manages a window which has a scrolling area
  9.         inside of it
  10.     
  11. ********************************************************************/
  12.  
  13. #include <CPPScrollWindow.h>
  14. #include <Commands.h>
  15. #include <MathTools.h>
  16.  
  17.  
  18. /*-----------------------------------------------------------------*/
  19. /*------------------------ PUBLIC METHODS -------------------------*/
  20. /*-----------------------------------------------------------------*/
  21.  
  22.     CPPScrollWindow::CPPScrollWindow (CPPWindowManager *theManager, int ResID, 
  23.                               Boolean HScroll, Boolean VScroll, 
  24.                               short hStep, short vStep) :
  25.                 CPPWindow (theManager, ResID),
  26.                 CPPScrollArea ((CPPWindow *)this, HScroll, VScroll,
  27.                                hStep, vStep)
  28.     /* most of the work is done in the initialization phase */
  29.     {
  30.         SetMinMaxSize(70, 70, kPageWidth + kSBarWidth,
  31.                          kPageHeight + kSBarWidth);
  32.     }
  33.                          
  34. /*-----------------------------------------------------------------*/
  35.                      
  36.     CPPScrollWindow::CPPScrollWindow (CPPWindowManager *theManager,
  37.                               Rect *bounds, StringPtr title, Boolean isVisible,
  38.                               int windowKind, Boolean hasGoAway, int RefCon,
  39.                               Boolean HScroll, Boolean VScroll, 
  40.                               short hStep, short vStep) :
  41.                  CPPWindow (theManager, bounds, title, isVisible,
  42.                              windowKind, hasGoAway, RefCon),
  43.                  CPPScrollArea ((CPPWindow *)this, HScroll, VScroll, 
  44.                                  hStep, vStep)
  45.     /* most of the work is done in the initialization phase */
  46.     {
  47.         SetMinMaxSize(70, 70, kPageWidth + kSBarWidth,
  48.                          kPageHeight + kSBarWidth);
  49.     }
  50.  
  51. /*-----------------------------------------------------------------*/
  52.  
  53.     CPPScrollWindow::~CPPScrollWindow (void)
  54.     {
  55.     
  56.     }
  57.  
  58. /*-----------------------------------------------------------------*/
  59.  
  60.     Boolean    CPPScrollWindow::Member (char *className)
  61.     {
  62.         if (strcmp(className, CPPScrollWindow::ClassName()) == 0)
  63.           return TRUE;
  64.         else
  65.           if (CPPWindow::Member(className))
  66.             return TRUE;
  67.           else
  68.             return CPPScrollArea::Member(className);
  69.     }
  70.  
  71. /*-----------------------------------------------------------------*/
  72.  
  73.     char    *CPPScrollWindow::ClassName (void)
  74.     {
  75.         return "CPPScrollWindow";
  76.     }
  77.  
  78. /*-----------------------------------------------------------------*/
  79.  
  80.     Boolean    CPPScrollWindow::DoCommand (short commandID)
  81.     /* the default method sends the command to the target of the */
  82.     /* window. */
  83.     /* SUBCLASS SHOULD OVERRIDE */
  84.     {
  85.         return CPPScrollArea::DoCommand(commandID);
  86.     }
  87.  
  88. /*-----------------------------------------------------------------*/
  89. /*---------------------- PROTECTED METHODS ------------------------*/
  90. /*-----------------------------------------------------------------*/
  91.     
  92.     void    CPPScrollWindow::DoUserClick (EventRecord *theEvent)
  93.     /* instance specific handler for clicking in the window */
  94.     /* SUBCLASS SHOULD OVERRIDE */
  95.     {
  96.         CPPScrollArea::DoClick (theEvent);    // scrollarea object method
  97.     }
  98.  
  99. /*-----------------------------------------------------------------*/
  100.  
  101.     void    CPPScrollWindow::DoUserUpdate (void)
  102.     /* instance specific handler for drawing the window's contents */
  103.     /* SUBCLASS SHOULD OVERRIDE */
  104.     {
  105.         this->Draw();    // scrollarea object method
  106.     }
  107.  
  108. /*-----------------------------------------------------------------*/
  109.  
  110.     void    CPPScrollWindow::DoUserIdle (void)
  111.     /* instance specific handler for idling when the window is */
  112.     /* the frontmost window */
  113.     /* SUBCLASS SHOULD OVERRIDE */
  114.     {
  115.         if (this->WisActive)
  116.           CPPScrollArea::DoIdle();    // textedit object method
  117.     }
  118.  
  119. /*-----------------------------------------------------------------*/
  120.  
  121.     void    CPPScrollWindow::DoUserChangeSize (short newWidth, short newHeight)
  122.     /* instance specific handler for resizing the window; use this */
  123.     /* opportunity to change the size of the scrollbars and TE area */
  124.     {
  125.         CPPScrollArea::Resize (newWidth, newHeight);    // textedit object method
  126.     }
  127.  
  128.